//
// See the file COPYING for redistribution information.
//

#include <iostream>
#include <Naipax.hpp>

using namespace std;
using namespace Naipax;

int main() {
    cerr << "Test for the Digest module" << endl;

    string Text = "1234567890qwertyuiopasdfghjkl;";
    char Digest[DIGEST_SIZE];
    char AsciiDigest[DIGEST_ASCII_SIZE];
    char Buf[32];
    
    try {
        for (uint32_t i = 0; i < 1024; ++i) {
            Digest::MakeAscii("", AsciiDigest);
            cout << AsciiDigest << endl;

            snprintf(Buf, 32, "%u", i);
            Text = Buf;
            Digest::MakeAscii(Text, AsciiDigest);
            cout << AsciiDigest << endl;

            Digest::Make(Text, Digest);
            Digest::BinaryToAscii(Digest, AsciiDigest);
            cout << AsciiDigest << endl;
        }
        Digest::Make(Text, NULL);
    }
    catch (Naipax::Error &E) {
        cerr << E.What() << endl;
    }
    return 0;
}
